FUNCTION DAC_SetBitOfDword :Dword
TITLE = 'DAC_SetBitOfDword'
//
// This functionblock set a single bit in a dword
// 
// Versionshistory:
// 1.0 Ersterstellung E.Dittmann

VERSION : '1.0'
AUTHOR  : 'Lenze'
FAMILY  : 'DAC'
NAME : 'xSetdw'
KNOW_HOW_PROTECT

CONST
    dat := DW#16#1;
END_CONST

VAR_INPUT
    dwInput:                    DWORD;                              // Inputdword
    byBitNr:                    BYTE;                               // Bitnumber (Range 0 - 31)
END_VAR

VAR
END_VAR

BEGIN
IF (BYTE_TO_INT(byBitNr) >= 0) AND (BYTE_TO_INT(byBitNr) <32) THEN
    DAC_SetBitOfDword := dwInput OR SHL(IN:=dat,N:=BYTE_TO_INT(byBitNr));
END_IF;

END_FUNCTION

